﻿using System.ServiceProcess;

namespace UDS.Management
{
    public partial class SMSSenderService : ServiceBase
    {
        private SmsSenderService _service;

        public SMSSenderService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            _service = new SmsSenderService();
            _service.Start();

#if false
            System.Action action = delegate
            {
                //RequestAdditionalTime(30 * 1000);
                while (!System.Diagnostics.Debugger.IsAttached)
                {
                    System.Threading.Thread.Sleep(200);
                }
                _service = new SmsSenderService();
                _service.Start();
            };

            action.BeginInvoke(null, null);
#endif
        }

        protected override void OnStop()
        {
            if (_service != null)
            {
                _service.Stop();
                _service.Dispose();
            }
        }
    }
}
